﻿using M_Process.API.Appliction.Command.ProductionProcessCommand;
using M_Process.Domain.DTO;
using M_Process.Domain;
using MediatR;
using M_Process.API.Appliction.Command;
using M_Process.Repository.ProcessImpl;
using M_Process.Repository.ProcessInterface;

namespace M_Process.API.Appliction.CommandHandlers
{
    public class ProcessProceduresCommandHandler : IRequestHandler<ProcessProceduresCommand, ProcessProcedures>
    {
        protected readonly IProcessRouteRepository processRoute;
        protected readonly IProcessProceduresRepository processProcedures;

        public ProcessProceduresCommandHandler(IProcessRouteRepository processRoute, IProcessProceduresRepository processProcedures)
        {
            this.processRoute = processRoute;
            this.processProcedures = processProcedures;
        }

        public async Task<ProcessProcedures> Handle(ProcessProceduresCommand request, CancellationToken cancellationToken)
        {
            return await processProcedures.GetModelsAsync(request.ProcessRouteId);
        }
    }

}
